package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.system.domain.SeckillOrder;
import com.ruoyi.system.service.ISeckillOrderService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;

import java.util.Date;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2025-10-09
 */
@Api(value = "/system/order", tags = {"【请填写功能名称】"})
@RestController
@RequestMapping("/system/order")
public class SeckillOrderController extends BaseController {
    @Autowired
    private ISeckillOrderService seckillOrderService;

/**
 * 查询【请填写功能名称】列表
 */
@ApiOperation(value = "查询【请填写功能名称】列表")
@ApiImplicitParams({
        @ApiImplicitParam(dataTypeClass = SeckillOrder.class, paramType = "body", dataType = "SeckillOrder", name = "seckillOrder", value = "the seckillOrder to list")
})
    @GetMapping("/list")
    public TableDataInfo list(SeckillOrder seckillOrder) {
        startPage();
        List<SeckillOrder> list = seckillOrderService.selectSeckillOrderList(seckillOrder);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @ApiOperation(value = "导出【请填写功能名称】列表")
    @ApiImplicitParams({
            @ApiImplicitParam(dataTypeClass = SeckillOrder.class, paramType = "body", dataType = "SeckillOrder", name = "seckillOrder", value = "the seckillOrder")
    })
            @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SeckillOrder seckillOrder) {
        List<SeckillOrder> list = seckillOrderService.selectSeckillOrderList(seckillOrder);
        ExcelUtil<SeckillOrder> util = new ExcelUtil<SeckillOrder>(SeckillOrder. class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @ApiOperation(value = "获取【请填写功能名称】详细信息")
            @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(seckillOrderService.selectSeckillOrderById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @ApiOperation(value = "新增【请填写功能名称】")
            @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SeckillOrder seckillOrder) {
                        return toAjax(seckillOrderService.save(seckillOrder));
    }

    /**
     * 修改【请填写功能名称】
     */
    @ApiOperation(value = "修改【请填写功能名称】 ")
            @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SeckillOrder seckillOrder) {
                        return toAjax(seckillOrderService.updateById(seckillOrder));
    }

    /**
     * 删除【请填写功能名称】
     */
    @ApiOperation(value = "删除【请填写功能名称】")
            @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(seckillOrderService.deleteSeckillOrderByIds(ids));
    }
}
